package cn.buk.tms.train.dao;

import cn.buk.tms.dao.BaseAbstractDao;
import cn.buk.tms.entity.misc.OperationLog;
import cn.buk.tms.entity.order.train.TrainRefundOrder;
import cn.buk.tms.train.sc.TrainOrderSearchCriteria;

import java.util.List;

/**
 * 火车票订单保存接口
 *
 * @author yfdai
 */
public interface TrainRefundOrderDao extends BaseAbstractDao {

    /**
     * 保存火车票订单
     * @param o
     * @return
     */
    int createOrder(TrainRefundOrder o);

    int createOrders(List<TrainRefundOrder> list);

    TrainRefundOrder getOrderById(int id);

    List<TrainRefundOrder> searchOrders(int enterpriseId, TrainOrderSearchCriteria sc, List<Integer> allowedCustomerIds);

    /**
     * 修改火车票订单的备注
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param remark
     * @return
     */
    int updateOrderRemark(int enterpriseId, String username, int orderId, String remark);

    int updateOrderExternalOrderNo(int enterpriseId, String username, int orderId, String externalOrderNo);

    /**
     * 修改订单价格
     * @param enterpriseId
     * @param username
     * @param orderId
     * @param price
     * @param cost
     * @param serviceCharge
     * @return
     */
    int updateOrderPrice(int enterpriseId, String username, int orderId, double price, double cost, double serviceCharge, double totalAmount, double totalCost, double profit);

    int processOrder(int enterpriseId, String username, int orderId);

    int finishOrder(int enterpriseId, String username, int orderId, String remark);

    List<OperationLog> searchOrderHistory(int enterpriseId, int orderId);

    /**
     * 取消火车票订单
     * @param enterpriseId
     * @param username
     * @param hotelOrderId
     * @param remark
     * @return
     */
    int cancelOrder(int enterpriseId, String username, int hotelOrderId, String remark);

    int rollbackOrder(int enterpriseId, String username, int orderId, final String remark);


    List<TrainRefundOrder> searchUnpaidOrders(int max);

}
